home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d939.lha
/
Upcat
/
DemoMacro.upcat
next >
Wrap
Text File
|
1993-12-20
|
8KB
|
332 lines
/*-----------------------------------------------------------------------*/
/* ARexx macro DemoMacro for Upcat. */
/* */
/* This macro shows some of the macro possibilities of Upcat. */
/* */
/* You may adapt this macro or use parts of it for your own needs, but */
/* this macro must be distributed unchanged. */
/* */
/* Author : Frans Zuydwijk */
/* Date : 24 September 1993 */
/*-----------------------------------------------------------------------*/
Trace Off
Options Results /* Get information returned in Result */
FileSelection = 'OFF'
Do Forever
Say ' 1. Show categories'
Say ' 2. Show volumes'
Say ' 3. Show directories'
Say ' 4. Show files'
Say ' 5. Show files sorted'
Say ' 6. Toggle file selection'
Say ' 7. Show records with path'
Say ' 8. Show selected record'
Say ' 9. Show requester'
Say '10. Open window on Upcat screen'
Say ' X. Exit macro'
Say
Options Prompt 'Choice : '
Pull Choice
Options Prompt
Say
Select
When Choice = '1' Then Call ShowCategories
When Choice = '2' Then Call ShowVolumes
When Choice = '3' Then Call ShowDirectories
When Choice = '4' Then Call ShowFiles
When Choice = '5' Then Call ShowFilesSorted
When Choice = '6' Then Call ToggleFileSelect
When Choice = '7' Then Call ShowRecords
When Choice = '8' Then Call ShowSelected
When Choice = '9' Then Call ShowRequester
When Choice = '10' Then Call OpenWindow
When Choice = 'X' Then Leave
Otherwise Nop
End
End
Exit
/*-----------------------------------------------------------------------*/
/* Show Categories */
/*-----------------------------------------------------------------------*/
ShowCategories : Procedure
Say 'Category Number Files'
Say
"FirstCat"
Do While RC = 0
Parse Var Result Name '/' Number '/' Count
If Name ~= ''
Then Say Left(Name,15) ' ' Right(Number,2) ' ' Right(Count,5)
"NextCat"
End
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Show Volumes */
/*-----------------------------------------------------------------------*/
ShowVolumes : Procedure
"FirstVol"
Do While RC = 0
Parse Var Result Level '/' Type '/' Name '/' Size '/' Date '/' ,
Time '/' Protect '/' Categories '/' Comment
Say Left(Name,30) Right(Size,6) 'KB Free'
"NextVol"
End
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Show Directories */
/*-----------------------------------------------------------------------*/
ShowDirectories : Procedure
"FirstDir"
Do While RC = 0
Parse Var Result Level '/' Type '/' Name '/' Size '/' Date '/' ,
Time '/' Protect '/' Categories '/' Comment
Say Left(Name,30) Date Time
"NextDir"
End
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Show Files */
/*-----------------------------------------------------------------------*/
ShowFiles : Procedure
Say 'The following list may be aborted by pressing RETURN'
Say
"FirstFile"
Do While (RC = 0) & (Lines(StdIn) = 0)
Parse Var Result Level '/' Type '/' Name '/' Size '/' Date '/' ,
Time '/' Protect '/' Categories '/' Comment
Say Left(Name,30) Date Time Right(Size,8) Protect
"NextFile"
End
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Show Files Sorted */
/*-----------------------------------------------------------------------*/
ShowFilesSorted : Procedure
Say 'The following list may be aborted by pressing RETURN'
Say
"FirstSortFile"
Do While (RC = 0) & (Lines(StdIn) = 0)
Parse Var Result Level '/' Type '/' Name '/' Size '/' Date '/' ,
Time '/' Protect '/' Categories '/' Comment
Say Left(Name,30) Date Time Right(Size,8) Protect
"NextSortFile"
End
If RC = 11
Then Say "Display type is not 'Files - xxx sorted'"
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Toggle FileSelect */
/*-----------------------------------------------------------------------*/
ToggleFileSelect : Procedure Expose FileSelection
If FileSelection = 'OFF' Then Argument = 'ON'; Else Argument = 'OFF'
"FileSelect" Argument
If RC = 0
Then Do
FileSelection = Argument
Say 'FileSelect is now' FileSelection
End
If RC = 11
Then Say 'No file selection criteria set; FileSelect is OFF'
Say
Return
/*-----------------------------------------------------------------------*/
/* Show Records */
/*-----------------------------------------------------------------------*/
ShowRecords : Procedure
Say 'The following list may be aborted by pressing RETURN'
Say
"FirstRec"
Do While (RC = 0) & (Lines(StdIn) = 0)
Parse Var Result Level '/' Type '/' Name '/' Size '/' Date '/' ,
Time '/' Protect '/' Categories '/' Comment
"Path"
Name = Result || Name
Type = Word('Volume Directory File', Pos(Type, 'VDF'))
Say Left(Type,9) Name
"NextRec"
End
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Show selected record */
/*-----------------------------------------------------------------------*/
ShowSelected : Procedure
"SelectRec"
If RC = 10
Then Do
Say 'You must select a record first'
Say
Return
End
Parse Var Result Level '/' Type '/' Name '/' Size '/' Date '/' ,
Time '/' Protect '/' Categories '/' Comment
"Path"
Path = Result
Say 'Level :' Level
Say 'Type :' Type
Say 'Name :' Name
Say 'Path :' Path
Say 'Size :' Size
Say 'Date :' Date
Say 'Time :' Time
Say 'Protect :' Protect
Say 'Categories :' Categories
Say 'Comment :' Comment
Call PressReturn
Return
/*-----------------------------------------------------------------------*/
/* Show requester */
/*-----------------------------------------------------------------------*/
ShowRequester : Procedure
Say 'The requester is on the Upcat main window now'
Say
"Requester" "Continue" "Demonstration requester|1-3 lines can be displayed"
"Requester" "OK|Cancel" "You can use the requester|to make choices"
If RC = 0 Then Choice = 'OK'
If RC = 5 Then Choice = 'Cancel'
"Requester" "Continue" "You chose" Choice || "|Go back to macro window"
Return
/*-----------------------------------------------------------------------*/
/* Open window on Upcat screen */
/*-----------------------------------------------------------------------*/
OpenWindow : Procedure
"ScreenName"
WindowParms = 'CON:160/50/320/100/Test window/Screen' Result
If Open('Console', WindowParms) = 0
Then Do
Say 'Cannot open window'
Say
Return
End
"CatalogName"
WriteLn('Console', 'CatalogName is :' Result)
WriteLn('Console', '')
Do Forever
WriteLn('Console', 'Type EXIT to close window')
If Upper(ReadLn('Console')) = 'EXIT' Then Leave
End
Close('Console')
Return
/*-----------------------------------------------------------------------*/
/* Wait until RETURN is pressed */
/*-----------------------------------------------------------------------*/
PressReturn : Procedure
Do While Lines(StdIn) ~= 0
Pull
End
Say
Say 'Press RETURN to continue...'
Pull
Return